﻿@model Nullable<System.DateTime>

@if ( Model.HasValue ) {
   @Html.TextBox("", String.Format("{0:dd-MMM-yyy}", Model.Value), new { @class = "datepicker2" })
}
else {
   @Html.TextBox("", String.Format("{0:dd-MMM-yyyy}", DateTime.Today), new { @class = "datepicker2" })
}
@{
string name = ViewData.TemplateInfo.HtmlFieldPrefix;
string id = name.Replace( ".", "_" );
}
<script type="text/javascript">

    jQuery(document).ready(function () {
        $(".datepicker2").datepicker
            ({
                dateFormat: 'dd-M-yy',
                showStatus: true
            });
    });
</script>